@extends('layouts.teacher')

@section('title', $clazz->name . ' - 学生列表')

@section('content')
<div class="panel panel-success">
    <div class="panel-heading">
        <h2 class="panel-title">
            {{ $clazz->name }} ({{ $clazz->code }}) - 学生列表
        </h2>
    </div>
    <div class="panel-body">
        <a href="{{ route('teacher.clazzes') }}" class="btn btn-default btn-sm">
            <span class="glyphicon glyphicon-arrow-left"></span> 返回班级列表
        </a>
        
        <hr>
        
        @if(count($students) > 0)
        <div class="table-responsive">
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th>学号</th>
                        <th>学生姓名</th>
                        <th>性别</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($students as $student)
                    <tr>
                        <td>{{ $student->student_id }}</td>
                        <td>{{ $student->name }}</td>
                        <td>
                            @if($student->gender == 'male')
                                <span class="label label-primary">男</span>
                            @else
                                <span class="label label-danger">女</span>
                            @endif
                        </td>
                        <td>
                            <button class="btn btn-sm btn-primary">
                                <span class="glyphicon glyphicon-comment"></span> 评价
                            </button>
                        </td>
                    </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
        @else
        <div class="alert alert-warning">
            该班级暂无学生数据。
        </div>
        @endif
    </div>
</div>
@endsection
